<!DOCTYPE html>
<html>
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <title>$.data</title>
        <script>
            window.$$path = location.protocol + "//" + location.host;
            document.write('<script src="' + $$path + '/mass_merge.js"><\/script>');
            document.write('<script src="' + $$path + '/doc/scripts/common.js"><\/script>');
        </script>
    </head>
    
    <body>
        <article>
            <h3>$.data(obj, name , value)</h3>
            <p>
                <span class="stress">描述：</span>
            </p>
            <p>为obj对象储存一个名为name，值为value的数据。</p>
            <p>
                <span class="stress">参数：</span>
            </p>
            <dl>
                <dt>obj</dt>
                <dd>必需。不为属性节点或文本节点的其他类型节点，文档对象，window对象，自定义对象等等。</dd>
                <dt>name</dt>
                <dd>必需。String。数据的名字。</dd>
                <dt>value</dt>
                <dd>必需。不为undefined的任意类型数据。数据的值。</dd>
            </dl>
            <p>
                <span class="stress">返回值：</span>
            </p>
            <p>value</p>
            <fieldset>
                <legend>例子</legend>
                <pre class="brush:javascript;gutter:false;toolbar:false">
$.require("data", function() {
    var val = $.data(document.body, "test1", [1, 2, 3]);
    $.log(document.body.uniqueNumber, true);
    $.log($.dump(val), true);
});
</pre>
                <button class="doc_btn" type="button">点我，执行代码</button>
            </fieldset>
            <h3>$.data(obj,object)</h3>
            <p>
                <span class="stress">描述：</span>
            </p>
            <p>为obj添加同时添加多个数据。</p>
            <p>
                <span class="stress">参数：</span>
            </p>
            <dl>
                <dt>obj</dt>
                <dd>必需。见上。</dd>
                <dt>object</dt>
                <dd>必需。Object。一个数据包。</dd>
            </dl>
            <p>
                <span class="stress">返回值：</span>
            </p>
            <p>obj在$.memcache或自身（如果是自定义对象）上的缓存体，它包含所有相关的数据。</p>
            <fieldset>
                <legend>例子</legend>
                <pre class="brush:javascript;gutter:false;toolbar:false">
$.require("data", function() {
    var val = $.data(document.body, {
        aa: "aa",
        bb: "bb"
    });
    $.log($.dump(val), true);
});
</pre>
                <button class="doc_btn" type="button">点我，执行代码</button>
            </fieldset>
            <h3>$.data(obj,name)</h3>
            <p>
                <span class="stress">描述：</span>
            </p>
            <p>取得与obj相关的名为name的数据。</p>
            <p>
                <span class="stress">参数：</span>
            </p>
            <dl>
                <dt>obj</dt>
                <dd>必需。见上。</dd>
                <dt>name</dt>
                <dd>必需。String。目标数据名。</dd>
            </dl>
            <p>
                <span class="stress">返回值：</span>
            </p>
            <p>name的值，没有返回undefined。</p>
            <fieldset>
                <legend>例子</legend>
                <pre class="brush:javascript;gutter:false;toolbar:false">
$.require("data", function() {
    var val = $.data(document.body, "aa");
    $.log(val, true);
});
</pre>
                <button class="doc_btn" type="button">点我，执行代码</button>
            </fieldset>
        </article>
    </body>

</html>